package com.fzg.common.demo.stream;

import java.io.*;

/**
 * create by fzg
 * 2022/11/17 11:43
 */


public class ConvertStream {
    public static void main(String[] args) {
        BufferedReader br = null;
        BufferedWriter bw = null;
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out));
            while(true){
                bw.write("请输入：");
                bw.flush();
                String input = br.readLine();
                if(input.equals("exit")){
                    break; //输入exit就结束
                }
                bw.write("你输入的是："+input);
                bw.newLine();
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bw != null){
                    bw.close();
                }
                if (br != null) {
                    br.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
